import configparser
from conf.setting import Setting

class ConfOpertion:
    def __init__(self,file_path=None):
        self.setting=Setting()
        if file_path:
            self.file_path=file_path
        else:
            self.file_path=self.setting.CONFIG_INI_PATH
        self.config= configparser.ConfigParser()
        self.config.read(self.file_path,encoding='utf-8')

    def get_sections(self):
        return self.config.sections()

    def get_options(self,section):
        return self.config.options(section=section)

    def get_value(self,section,option):
        return self.config.get(section=section,option=option)

    def get_api_envi_value(self,option):
        section='api_envi'
        return self.config.get(section=section,option=option)

    def get_mysql_value(self,option):
        section='MYSQL'
        return self.config.get(section=section,option=option)

    def get_jenkins_value(self,option):
        section='JENKINS'
        return self.config.get(section=section,option=option)